package com.example.manpower.Controller;

import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.example.manpower.Dto.SalartStats;
import com.example.manpower.Dto.UserExport;
import com.example.manpower.Entity.Salary;
import com.example.manpower.Entity.User;
import com.example.manpower.Server.SalaryService;
import com.example.manpower.Util.Result;
import org.apache.poi.ss.usermodel.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.net.URLEncoder;
import java.util.List;
import java.util.stream.Collectors;

@RestController
@RequestMapping("/Salary")
public class SalaryController {
    @Autowired
    private SalaryService salaryService;

    @GetMapping("/selectPage")
    public Result select(SalartStats salartStats) {
        return salaryService.select(salartStats);
    }

    @PostMapping("/update")
    public Result update(@RequestBody Salary salary) {
        System.out.println(salary.getUserId());
        System.out.println(salary.getBasicWage());
        return salaryService.update(salary);
    }
}
